﻿@model A_Shop.Controllers.productoform

@{
    ViewBag.Title = "Create";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
}

<h2>Crear</h2>

@using (Html.BeginForm(
    null, null, FormMethod.Post, new { enctype = "multipart/form-data" }
    ))
{
    @Html.ValidationSummary(true)


    <fieldset>
        <legend>Producto</legend>

        

        <div class="editor-label">
            @Html.LabelFor(model => model.nombre)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.nombre)
            @Html.ValidationMessageFor(model => model.nombre)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.modelo)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.modelo)
            @Html.ValidationMessageFor(model => model.modelo)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.marca_id)
        </div>
        <select id="marca_id" name="marca_id">
            @using (var db = new A_Shop.Models.ContextDatos())
            {
                foreach (var m in db.Marcas)
                {
                    <option value="@m.id">@m.Nombre</option>
                }
            }
        </select>
        <div class="editor-label">
            @Html.LabelFor(model => model.precio)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.precio)
            @Html.ValidationMessageFor(model => model.precio)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.descripcion)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.descripcion)
            @Html.ValidationMessageFor(model => model.descripcion)
        </div>

        <div class="editor-label">
            Foto
        </div>
        <div class="editor-label">
          <input type="file" name="Archivo" id="Archivo" />
        </div>
        <p>
            <input type="submit" value="Crear" class="btn btn-info"/>
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
